import React, { Component } from 'react'
import propTypes from 'prop-types'

export default class Navbar extends Component {
    static propTypes = {
        title: propTypes.string,
        leftShow: propTypes.bool
    }
    render() {
        // 展开赋值，对象解构，title 对应属性名称
        let { title, leftShow } = this.props
        return (
            <div>
                {leftShow && <button>返回</button> }
                Navbar-{title}
                <button>Home</button>
            </div>
        )
    }
}

Navbar.defaultProps = {
    leftShow: true
}

// 类属性
// Navbar.propTypes = {
//     title: propTypes.string,
//     leftShow: propTypes.bool
// }
